<template>
	<view class="content-structure-framework u-flex u-flex-col">
		<view class="xxl u-font-weight-500 u-padding-30">
			{{detail.title||""}}
		</view>
		<view class="u-flex-1">
			<u-parse v-if="detail.type == 1" class="u-padding-20 main-content-area bg-white" style="min-height: 50vh;" :html="detail.content||''"></u-parse>
			<!-- 视频 -->
			<video class="video-area" v-if="detail.type == 2" :src="detail.file"></video>
			<!-- 音频 -->
			<view v-if="detail.type == 3" class="main-content-area u-padding-top-20">
				<le-audio
					:activeIndex="0"
				    :audioData="[
						{
							title:detail.title,
							fileUrl:detail.file
						}
					]"
				    :showAudioSpeedIcon="true"
				    :autoplay="false"
				></le-audio>
			</view>
			<comment-area class="u-margin-top-20 comment-area" :id="detail.id" :type="5"></comment-area>
		</view>
		<xy-loading v-if="loadingShowStatus"></xy-loading>
	</view>
</template>
<script>
	import {
		queryMaterialDetailDatas
	} from '@/api/course'
	export default {
		data() {
			return {
				id: 0,
				detail: {},
				loadingShowStatus: true
			};
		},
		onLoad(e) {
			if (!uni.$u.test.isEmpty(e.id)) this.id = e.id;
			this.queryMaterialDetailDatasFun()
		},
		methods: {
			async queryMaterialDetailDatasFun() {
				let {
					data
				} = await queryMaterialDetailDatas({
					id: this.id
				});
				this.detail = data
				this.loadingShowStatus = false
			}
		}

	}
</script>
<style lang="scss">
	page {
		min-height: 100vh;
		background: url(https://resource.lanbaozixun.com/uploads/images/202406151200573edf76650.png) no-repeat;
		background-size: 100% auto;

		.content-structure-framework {
			min-height: 100vh;
			
			.main-content-area{
				width: 100vw;
				border-radius: 20rpx;
			}
			
			.video-area{
				width: 100vw;
			}
		}
		
		.comment-area{
			background: transparent;
		}

	}
</style>